package com.cxs.service.impl;

import com.cxs.service.MqttService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter;
import org.springframework.stereotype.Service;

/**
 * @Author CXS
 * @Date 2024/1/26 17:45
 **/
@Service
@Slf4j
public class MqttServiceImpl implements MqttService {

    @Autowired
    private MqttPahoMessageDrivenChannelAdapter adapter;

    @Override
    public void addTopic(String topic, int qos) {
        log.info("添加订阅主题");
        adapter.addTopic(topic, qos);
    }

    @Override
    public void removeTopic(String topic) {
        adapter.removeTopic(topic);
    }
}
